import request from "@/utils/request";
import { stringify } from 'qs';
import { toFormData } from '@/utils/utils.jsx';

//售后单主列表
export function getAfterSalesList(params) {
	return request(`/new-oms-search/esAfterSale/esPage`, {
		method: "POST",
		data: params
		// baseURL: mockURL,
	});
}

//退款超时计数 
export function getTimeoutCountOp(params) {
  return request(`/new-oms-search/esAfterSale/refundTimeoutCount?${stringify(params)}`);
}

//统计
export function getStatisticsOp() {
  return request(`/new-oms-search/esAfterSale/statistics`);
}

//根据id查询售后单信息-局部刷新
export function getAfterSalesListById(params) {
	return request(`/new-oms-search/esAfterSale/selectByIds`, {
		method: "POST",
		data: params
		// baseURL: mockURL,
	});
}

//查询订单信息
export function getOrderData(params) {
	return request(`/new-oms-ec/afterSale/orderQuery?${stringify(params)}`);
}

//获取各种配置信息-页面维度
export function getFieldConfig(params) {
	return request(`/new-common/quickQueryLabel/getByCode?${stringify(params)}`, {
		method: 'GET',
		// baseURL: mockURL,
	});
}

//更新各种配置信息-页面维度
export function updateFieldConfig(params) {
	return request(`/new-common/quickQueryLabel/saveOrUpdate`, {
		method: 'POST',
		data: params,
		// baseURL: mockURL,
	});
}

//退货快递列表
export function queryExpressList(params) {
	return request(`/blade-logistics/express/listBase?${stringify(params)}`);
}

//获取备注回传配置
export async function getConditionOp(params) {
	return request('/new-common/afterSalesRemark/getCondition', {
		method: 'post',
		body: toFormData(params)
	});
}

//设置备注回传配置
export async function saveConditionOp(params) {
	return request('/new-common/afterSalesRemark/saveCondition', {
		method: 'post',
		data: params,
	});
}

//子账号授权相关
export async function getEslistGroup(params) {
	return request(`/blade-goods/ecSubuser/listGroup`, {
		method: 'post',
		data: params,
	});
}

//子账号授权相关
export async function setEsListGroupDefault(params) {
	return request('/blade-goods/ecSubuser/setDefault', {
		method: 'post',
		data: params,
	});
}

//同意退款
export async function agreeWithRefund(params) {
	return request('/new-oms-ec/afterSale/agreeWithRefund', {
		method: 'post',
		data: params,
	});
}

//同意退货
export async function agreeWithReturn(params) {
	return request('/new-oms-ec/afterSale/agreeWithReturn', {
		method: 'post',
		data: params,
	});
}

//同意补发/换货
export async function agreeExchange(params) {
	return request('/new-oms-ec/afterSale/agreeExchange', {
		method: 'post',
		data: params,
	});
}

//拒绝仅退款
export async function rejectAndRefund(params) {
	return request('/new-oms-ec/afterSale/rejectAndRefund', {
		method: 'post',
		data: params,
	});
}

//拒绝买家退货
export async function rejectbuyerReturn(params) {
	return request('/new-oms-ec/afterSale/rejectSalesReturn', {
		method: 'post',
		data: params,
	});
}

//拆包异常，拒绝退款
export async function rejectUnpackException(params) {
	return request('/new-oms-ec/afterSale/rejectUnpackException', {
		method: 'post',
		data: params,
	});
}

//拒绝补发/换货
export async function refusalOfReplacement(params) {
	return request('/new-oms-ec/afterSale/refusalOfReplacement', {
		method: 'post',
		data: params,
	});
}


//售后地址列表
export function getAfterSalesAddressList(params) {
	return request(`/blade-goods/aftersalesaddress/getAfterSalesAddressList?${stringify(params)}`);
}

//同步售后地址
export function syncAfterSalesAddress(params) {
	return request(`/blade-goods/aftersalesaddress/syncAddress?${stringify(params)}`);
}

//拒绝原因列表
export function reasonRefusalList(params) {
	return request(`/new-oms-ec/afterSale/reasonRefusalList`, {
		method: 'post',
		data: params,
	});
}

//处理结果列表
export function aftersaleoperationlog(params) {
	return request(`/new-oms-ec/aftersaleoperationlog/page?${stringify(params)}`);
}

//处理结果详情统计信息
export function aftersalelogDetailCount(params) {
	return request(`/new-oms-ec/aftersaleoperationlog/detailStatistics?${stringify(params)}`);
}

//处理结果详情结果
export function aftersalelogDetail(params) {
	return request(`/new-oms-ec/aftersaleoperationlog/detail?${stringify(params)}`);
}

//手动创建售后单
export function manualCreate(params) {
	return request(`/new-oms-ec/afterSale/manualCreate`, {
		method: 'post',
		data: params,
	});
}

//无信息件认领
export function noHeadClaim(params) {
	return request(`/new-oms-ec/afterSale/noHeadClaim`, {
		method: 'post',
		data: params,
	});
}

//导出售后单
export function createExportTask(params) {
	return request(`/blade-log/taskInfo/createExportTask`, {
		method: 'post',
		data: params,
	});
};


